//
//  CTMediator+Target_A.m
//  MediatorKit
//
//  Created by GuoMs on 2018/9/4.
//

#import "CTMediator+Target_A.h"

@implementation CTMediator (Target_A)

- (UIViewController*)ctm_componentAControllerWithTitle:(NSString *)title {
    
    //这里的A就是 Target_A得到的
    //getComponentAcontroller 是Target_A中 Action_getComponentAcontroller去掉Action_得到的
    UIViewController *controller =  [self performTarget:@"A"
                                                 action:@"getComponentAcontroller"
                                                 params:@{@"title":title?:@""}
                                      shouldCacheTarget:NO];
    
    if ([controller isKindOfClass:[UIViewController class]]) {
        
        return controller;
    } else {
        return nil;
    }
}

- (NSString*)ctm_getString {
    
    NSString *str = [self performTarget:@"A"
                                 action:@"getString"
                                 params:@{}
                      shouldCacheTarget:NO];
    
    return str;
}


- (void)ctm_doSomethingAsyncComplete:(void(^)(BOOL isSuccess))complete {
    
    NSDictionary *param = @{@"complete":[complete copy]};
    [self performTarget:@"A"
                 action:@"asyncMethod"
                 params:param
      shouldCacheTarget:NO];
    
}

@end
